home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / midi / gfft.lha / gfft-2.03 / source / gfft-2.03-source.lha / wbfilerq.c < prev    next >
C/C++ Source or Header  |  1996-01-02  |  3KB  |  103 lines

  1. /***************************************************************************
  2.  *          Copyright (C) 1994  Charles P. Peterson                  *
  3.  *         4007 Enchanted Sun, San Antonio, Texas 78244-1254             *
  4.  *              Email: Charles_P_Peterson@fcircus.sat.tx.us                *
  5.  *                                                                         *
  6.  *          This is free software with NO WARRANTY.                  *
  7.  *          See gfft.c, or run program itself, for details.              *
  8.  *              Support is available for a fee.                      *
  9.  ***************************************************************************
  10.  *
  11.  * Program:     gfft--General FFT analysis
  12.  * File:        wbfilerq.c
  13.  * Purpose:     file requestor
  14.  * Author:      Charles Peterson (CPP)
  15.  * History:     11-Dec-1993 CPP; Created.
  16.  *              8-Aug-94 CPP (1.10); force string to generic for now
  17.  * Comments:    Workbench GUI.  Amiga Dependent!  AmigaDOS 2.0+ required!
  18.  *              This is based on techniques from the Amiga RKRM examples
  19.  *              distributed freely by Commodore Amiga.  I thank them.
  20.  */
  21.  
  22. #ifdef AMIGA
  23.  
  24. #include <stdio.h>
  25. #include <string.h>
  26. /*
  27.  * Amiga includes
  28.  */
  29. #include <exec/types.h>
  30. #include <exec/libraries.h>
  31. #include <libraries/asl.h>
  32. #include <clib/exec_protos.h>
  33. #include <clib/asl_protos.h>
  34. #include <clib/dos_protos.h>    /* DOS AddPart() */
  35.  
  36. #include "gfft.h"
  37. #include "errcodes.h"
  38.  
  39. #define FR_LEFTEDGE 0
  40. #define FR_TOPEDGE  0
  41. #define FR_WIDTH    420
  42. #define FR_HEIGHT   400
  43.  
  44.  
  45. struct Library *AslBase = NULL;  /* prevents startup from loading it */
  46.                                  /* which is very bad if running 1.3 */
  47.  
  48. struct FileRequester *File_Requesterp = NULL;
  49. #define FRP File_Requesterp      /* short alias here for long expressions */
  50.  
  51. struct TagItem frtags[] =
  52. {
  53.     ASL_Hail,       (ULONG) NULL,    /* This gets filled in later */
  54.     ASL_Height,     FR_HEIGHT,
  55.     ASL_Width,      FR_WIDTH,
  56.     ASL_LeftEdge,   FR_LEFTEDGE,
  57.     ASL_TopEdge,    FR_TOPEDGE,
  58.     TAG_DONE
  59. };
  60.  
  61. char *file_requestor (char *hail_message)
  62. {
  63.     ULONG blen = 0;
  64.     unsigned char *buffer = NullString;
  65.  
  66. /*
  67.  * Hail message doesn't change
  68.  * Fix next time, for now, just use a neutral message
  69.  */
  70.  
  71.     frtags[0].ti_Data = (ULONG) "Select File";
  72.  
  73.     if (!AslBase)
  74.     {
  75.     if (!(AslBase = OpenLibrary("asl.library", 37L)))
  76.     {
  77.         error_message (NO_FILE_REQSTR);
  78.         return (char *) buffer;
  79.     }
  80.     }
  81.  
  82.     if (!FRP)
  83.     {      
  84.         if (!(FRP = (struct FileRequester *)
  85.             AllocAslRequest(ASL_FileRequest, frtags)))
  86.         {
  87.         error_message (OUT_OF_MEMORY);
  88.         return (char *) buffer;
  89.     }
  90.     }
  91.  
  92.     if (AslRequest(FRP, NULL))
  93.     {
  94.     blen = strlen (FRP->rf_Dir) + strlen (FRP->rf_File) + 10;
  95.     buffer = gmalloc (blen, NOTHING_SPECIAL);
  96.     strcpy (buffer, FRP->rf_Dir);
  97.     AddPart (buffer, FRP->rf_File, blen);
  98.     }
  99.     return (char *) buffer;
  100. }
  101.  
  102. #endif /* ifdef AMIGA */
  103.